package demo2;

/**
 * @Author liangzai
 * @Description:
 */
class Person{
    int age;
    String name;

    public void sayHello(){
        System.out.println("nice to meet you.");
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

class Student extends Person {

    @Override
    public void sayHello() {
        System.out.println(String.format("Hey nice to meet you. I am a student, my name is %s. I am %d years old.", this.name, this.age));
    }

}

// ---------------------End------------------------
public class FinalKeyWord {

    public static void main(String[] args) {
        Person student = new Student();
        student.setAge(18);
        student.setName("张三");
        student.sayHello();
    }
}

